namespace Maple.Branch.Permissions
{
    using Microsoft.Extensions.DependencyInjection;
    using Options;
    using TestDatas;
    using Volo.Abp.Authorization.Permissions;
    using Volo.Abp.Modularity;

    [DependsOn(typeof(PermissionsAppServiceModule),
        typeof(PermissionsEfCoreTestModule))]
    public class PermissionsAppTestModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.AddAlwaysAllowAuthorization();

            context.Services.Configure<PermissionProviderOptions>(options =>
            {
                options.ProviderPolicies[UserPermissionValueProvider.ProviderName] = UserPermissionValueProvider.ProviderName;
                options.ProviderPolicies["Test"] = "Test";
                options.ManagementProviders.Add<TestPermissionManagementProvider>();
            });
        }
    }
}
